package com.ge.modules.entity;

import com.ge.utils.DateUtil;
import com.ge.utils.OrderUtil;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;



/**
 * 订单表
 * 
 * @author lanyonglin
 * @email www.baidu.com
 * @date 2018-04-20 15:51:26
 */
public class  TbOrderEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	
	//
	private Integer id;
	//订单编码
	private String orderCode;
	//商品id
	private Integer commodityId;
	//用户id
	private Integer userId;
	//商品主人即设计师等编码
	private Integer commodityMasterId;
	//商品主人所在店铺编码
	private Integer commodityMasterStoreId;
	//店铺名称
	private String storeName;
	//扫码时间 店铺扫码用户
	private Date scanCodeTime;
	//收益 平台抽佣之后店铺所获得的金额
	private BigDecimal reapMoney;
	//商品图片路径
	private String imgurl;
	//商品名称
	private String commodityName;
	//商品数量
	private Integer commodityNumber;
	//联系人
	private String contact;
	//手机号
	private String phone;
	//订单状态 0待付款 1待接单 2已接单 3已拒单 4待使用 5已完成 6待评价 7售后
	private Integer orderStatus;
	//商品地址
	private String orderAddress;
	//订单实付金额
	private BigDecimal orderPrice;
	//订单支付类型 0 余额 1支付宝 2微信
	private Integer orderpayType;
	//订单接受状态 0新订单 1已接单 2已拒单 3已完成
	private Integer orderAcceptStatus;
	//预约时间
	private Date appointmentTime;
	//创建时间/付款时间
	private Date createTime;
	//订单显示状态 删除状态 0未删除 1已删除
	private Integer deleteType;
	//买家留言
	private String buyerMassage;
	//创建的月份
	private String createMonth;
	//创建的年份
	private String createYears;
	//接单和拒单时间
	private Date acceptAndRefuseOrderTime;
	//总订单编号
	private String orderHeaderCode;
	//拒单原因
	private String whyRefuseOrder;
	//订单金额 有抵扣的存在
	private BigDecimal price;
	//订单向店铺支付密码
	private String payToStorePassword;
	//状态更新时间
	private Date updateTime;


	public TbOrderEntity() {
	}

	public TbOrderEntity(String orderCode) {
		this.orderCode = orderCode;
	}

	public TbOrderEntity(TbCommodityEntity tbCommodityEntity, TbUser tbUser, TbStoreEntity tbStoreEntity,
						 TbTechnicianEntity technicianEntity, int commodityNumber,
						 String appointmentTime, String buyerMassage, String orderHeaderCode) {
		this.orderCode = OrderUtil.getOrderNo();
		this.commodityId = tbCommodityEntity.getCommodityId();
		this.userId = tbUser.getUserId();
		//设计师编码
		this.commodityMasterId = technicianEntity.getTechnicianId();
		//店家编码
		this.commodityMasterStoreId = tbStoreEntity.getStoreId();
		//店家名字
		this.storeName = tbStoreEntity.getStoreName();
//		this.scanCodeTime = scanCodeTime;
//		this.reapMoney = reapMoney;
		this.imgurl = tbCommodityEntity.getImgurl();
		this.commodityName = tbCommodityEntity.getCommodityName();
		this.commodityNumber = commodityNumber;
		this.contact = tbUser.getRealname();
		this.phone = tbUser.getMobile();
//		this.contact = "张三";
//		this.phone = "13540698341";
		this.orderStatus = 0;
		//店家地址
		this.orderAddress = tbStoreEntity.getStoreAddress();
		//按分储存
		this.orderPrice = tbCommodityEntity.getPrice();
		this.orderpayType = 0;
		//默认新订单
		this.orderAcceptStatus = 0;
		this.appointmentTime = DateUtil.toDate(appointmentTime);
		this.createTime = new Date();
		//默认未删除
		this.deleteType = 0;
		//可以为空
		this.buyerMassage = buyerMassage;
		//初始化得到当前的年和月
		this.createYears = DateUtil.getYaersAndMonth()[0];
		this.createMonth = DateUtil.getYaersAndMonth()[1];
		this.orderHeaderCode = orderHeaderCode;
		this.updateTime = new Date();

	}


	public Integer getCommodityId() {
		return commodityId;
	}

	public void setCommodityId(Integer commodityId) {
		this.commodityId = commodityId;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getOrderHeaderCode() {
		return orderHeaderCode;
	}

	public void setOrderHeaderCode(String orderHeaderCode) {
		this.orderHeaderCode = orderHeaderCode;
	}

	public Date getAcceptAndRefuseOrderTime() {
		return acceptAndRefuseOrderTime;
	}

	public void setAcceptAndRefuseOrderTime(Date acceptAndRefuseOrderTime) {
		this.acceptAndRefuseOrderTime = acceptAndRefuseOrderTime;
	}
	public String getCreateMonth() {
		return createMonth;
	}

	public void setCreateMonth(String createMonth) {
		this.createMonth = createMonth;
	}

	public String getCreateYears() {
		return createYears;
	}

	public void setCreateYears(String createYears) {
		this.createYears = createYears;
	}

	/**
	 * 设置：
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	/**
	 * 获取：
	 */
	public Integer getId() {
		return id;
	}
	/**
	 * 设置：订单编码
	 */
	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}
	/**
	 * 获取：订单编码
	 */
	public String getOrderCode() {
		return orderCode;
	}

	public Integer getCommodityMasterId() {
		return commodityMasterId;
	}

	public void setCommodityMasterId(Integer commodityMasterId) {
		this.commodityMasterId = commodityMasterId;
	}

	public Integer getCommodityMasterStoreId() {
		return commodityMasterStoreId;
	}

	public void setCommodityMasterStoreId(Integer commodityMasterStoreId) {
		this.commodityMasterStoreId = commodityMasterStoreId;
	}

	/**
	 * 设置：店铺名称
	 */
	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}
	/**
	 * 获取：店铺名称
	 */
	public String getStoreName() {
		return storeName;
	}
	/**
	 * 设置：扫码时间 店铺扫码用户
	 */
	public void setScanCodeTime(Date scanCodeTime) {
		this.scanCodeTime = scanCodeTime;
	}
	/**
	 * 获取：扫码时间 店铺扫码用户
	 */
	public Date getScanCodeTime() {
		return scanCodeTime;
	}
	/**
	 * 设置：收益 平台抽佣之后店铺所获得的金额
	 */
	public void setReapMoney(BigDecimal reapMoney) {
		this.reapMoney = reapMoney;
	}
	/**
	 * 获取：收益 平台抽佣之后店铺所获得的金额
	 */
	public BigDecimal getReapMoney() {
		return reapMoney;
	}
	/**
	 * 设置：商品图片路径
	 */
	public void setImgurl(String imgurl) {
		this.imgurl = imgurl;
	}
	/**
	 * 获取：商品图片路径
	 */
	public String getImgurl() {
		return imgurl;
	}
	/**
	 * 设置：商品名称
	 */
	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}
	/**
	 * 获取：商品名称
	 */
	public String getCommodityName() {
		return commodityName;
	}
	/**
	 * 设置：商品数量
	 */
	public void setCommodityNumber(Integer commodityNumber) {
		this.commodityNumber = commodityNumber;
	}
	/**
	 * 获取：商品数量
	 */
	public Integer getCommodityNumber() {
		return commodityNumber;
	}
	/**
	 * 设置：联系人
	 */
	public void setContact(String contact) {
		this.contact = contact;
	}
	/**
	 * 获取：联系人
	 */
	public String getContact() {
		return contact;
	}
	/**
	 * 设置：手机号
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}
	/**
	 * 获取：手机号
	 */
	public String getPhone() {
		return phone;
	}
	/**
	 * 设置：订单状态 0待付款 1待使用 2待评价 3售后
	 */
	public void setOrderStatus(Integer orderStatus) {
		this.orderStatus = orderStatus;
	}
	/**
	 * 获取：订单状态 0待付款 1待使用 2待评价 3售后
	 */
	public Integer getOrderStatus() {
		return orderStatus;
	}
	/**
	 * 设置：商品地址
	 */
	public void setOrderAddress(String orderAddress) {
		this.orderAddress = orderAddress;
	}
	/**
	 * 获取：商品地址
	 */
	public String getOrderAddress() {
		return orderAddress;
	}
	/**
	 * 设置：订单实付金额
	 */
	public void setOrderPrice(BigDecimal orderPrice) {
		this.orderPrice = orderPrice;
	}
	/**
	 * 获取：订单实付金额
	 */
	public BigDecimal getOrderPrice() {
		return orderPrice;
	}
	/**
	 * 设置：订单支付类型
	 */
	public void setOrderpayType(Integer orderpayType) {
		this.orderpayType = orderpayType;
	}
	/**
	 * 获取：订单支付类型
	 */
	public Integer getOrderpayType() {
		return orderpayType;
	}
	/**
	 * 设置：订单接受状态 0新订单 1已接单 2已拒单 3已完成
	 */
	public void setOrderAcceptStatus(Integer orderAcceptStatus) {
		this.orderAcceptStatus = orderAcceptStatus;
	}
	/**
	 * 获取：订单接受状态 0新订单 1已接单 2已拒单 3已完成
	 */
	public Integer getOrderAcceptStatus() {
		return orderAcceptStatus;
	}
	/**
	 * 设置：预约时间
	 */
	public void setAppointmentTime(Date appointmentTime) {
		this.appointmentTime = appointmentTime;
	}
	/**
	 * 获取：预约时间
	 */
	public Date getAppointmentTime() {
		return appointmentTime;
	}
	/**
	 * 设置：创建时间/付款时间
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	/**
	 * 获取：创建时间/付款时间
	 */
	public Date getCreateTime() {
		return createTime;
	}

	public Integer getDeleteType() {
		return deleteType;
	}

	public void setDeleteType(Integer deleteType) {
		this.deleteType = deleteType;
	}

	/**
	 * 设置：买家留言
	 */
	public void setBuyerMassage(String buyerMassage) {
		this.buyerMassage = buyerMassage;
	}
	/**
	 * 获取：买家留言
	 */
	public String getBuyerMassage() {
		return buyerMassage;
	}

	public String getWhyRefuseOrder() {
		return whyRefuseOrder;
	}

	public void setWhyRefuseOrder(String whyRefuseOrder) {
		this.whyRefuseOrder = whyRefuseOrder;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public String getPayToStorePassword() {
		return payToStorePassword;
	}

	public void setPayToStorePassword(String payToStorePassword) {
		this.payToStorePassword = payToStorePassword;
	}
}
